package com.example.mobile2121606110syc0505;

import static android.app.ProgressDialog.show;

import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView tvMainTitle2;
    private EditText edtTxtMainUserName;
    private EditText edtTxtMainPassword;
    private Button btnMainLogin;
    private Button btnMainRegister;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        initView();
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btnMainLogin:
                if(edtTxtMainUserName.getText().toString().equals("admin")&
                edtTxtMainPassword.getText().toString().equals("123456"))
                new AlertDialog.Builder(this)
                        .setTitle("登录信息")
                        .setMessage("登录成功")
                        .setPositiveButton("确定",null)
                        .create()
                        .show();
                        break;
            case R.id.btnMainRegister:
                Intent intent = new Intent(RegisterActivity.this,RegisterActivity2.class);
                startActivity(intent);
                break;
        }

        }

    private void initView() {
        tvMainTitle2 = (TextView) findViewById(R.id.tvMainTitle2);
        edtTxtMainUserName = (EditText) findViewById(R.id.edtTxtMainUserName);
        edtTxtMainPassword = (EditText) findViewById(R.id.edtTxtMainPassword);
        btnMainLogin = (Button) findViewById(R.id.btnMainLogin);
        btnMainRegister = (Button) findViewById(R.id.btnMainRegister);
        btnMainRegister.setOnClickListener(this);
        btnMainLogin.setOnClickListener(this);
    }
}